/**
 * Created with IntelliJ IDEA.
 * User: 12629
 * Date: 2021/10/20
 * Time: 10:32
 * Description:
 */
class Calculator {
    private int num1;
    private int num2;

    public int getNum1() {
        return num1;
    }

    public void setNum1(int num1) {
        this.num1 = num1;
    }

    public int getNum2() {
        return num2;
    }

    public void setNum2(int num2) {
        this.num2 = num2;
    }

    public int add() {
        return this.num1+this.num2;
    }

    public int sub() {
        return this.num1-this.num2;
    }
    public int mul() {
        return this.num1*this.num2;
    }

    public double dev() {
        return this.num1*1.0/this.num2;
    }
}

class MyValue {
    public int val;//
}

public class TestDemo3 {


    public static void swap2(MyValue mv1,MyValue mv2) {
        int tmp = mv1.val;
        mv1.val = mv2.val;
        mv2.val = tmp;
    }


    public static void main(String[] args) {
        MyValue myValue1 = new MyValue();
        myValue1.val = 10;
        MyValue myValue2 = new MyValue();
        myValue2.val = 20;

        System.out.println(myValue1.val+" " +myValue2.val);
        swap2(myValue1,myValue2);
        System.out.println(myValue1.val+" " +myValue2.val);

    }

    public static void swap(int a,int b) {
        int tmp = a;
        a = b;
        b = tmp;
    }

    public static void main2(String[] args) {
        int x = 10;
        int y = 20;
        swap(x,y);
        System.out.println(x+" " +y);
    }

    public static void main1(String[] args) {
        Calculator calculator = new Calculator();
        calculator.setNum1(10);
        calculator.setNum2(20);
        System.out.println(calculator.add());
        System.out.println(calculator.sub());
        System.out.println(calculator.mul());
        System.out.println(calculator.dev());
    }
}
